package com.sphd.emanu.activity.pointscenter;

import android.content.Context;

import com.google.gson.JsonObject;
import com.sphd.emanu.mvp.BasePresenterImpl;
import com.sphd.emanu.pojo.vip.MemberForOrg;
import com.sphd.emanu.utils.GsonUtil;
import com.wzutils.L;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * MVPPlugin
 *  邮箱 784787081@qq.com
 */

public class PointscenterPresenter extends BasePresenterImpl<PointscenterContract.View> implements PointscenterContract.Presenter{

    @Override
    public void findMemberPoint(int member, int org, final int status) {
            emanuService.findMemberPoint(member, org, status).enqueue(new Callback<String>() {
                @Override
                public void onResponse(Call<String> call, Response<String> response) {
                    L.e(response.toString());
                    L.e(response.body());
                    mView.recBean(GsonUtil.GsonToBean(response.body(), MemberForOrg.class),status);
                }

                @Override
                public void onFailure(Call<String> call, Throwable t) {
                    Error(t);
                }
            });
    }

    @Override
    public void getMemberPoint(int member, int org, int number) {
        emanuService.getMemberPoint(member, org, number).enqueue(new Callback<JsonObject>() {
            @Override
            public void onResponse(Call<JsonObject> call, Response<JsonObject> response) {
                mView.recRes(res(response));
            }

            @Override
            public void onFailure(Call<JsonObject> call, Throwable t) {
                Error(t);
            }
        });
    }
}
